import service from '@/utils/request'

const groupPrefix = "/user"


// @Summary 用户登录
// @Produce  application/json
// @Param data body {username:"string",password:"string"}
// @Router /user/login [post]
export const login = (data) => {
  return service({
    url: '/login',
    method: 'post',
    data: data
  })
}

// @Summary 用户注册
// @Produce  application/json
// @Param data body {username:"string",password:"string"}
// @Router /user/register [post]
export const register = (data) => {
  return service({
    url: '/register',
    method: 'post',
    data: data
  })
}


// 暂时没用
// @Tags User
// @Summary 获取用户信息
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /user/getUserInfo [get]
export const getUserInfo = () => {
  return service({
    url: groupPrefix + '/getUserInfo',
    method: 'get'
  })
}

// @Summary 用户注册
// @Produce  application/json
// @Router /user/home [get]
export const updateCertifyCode = () => {
  return service({
    url: groupPrefix + '/updateCertifyCode',
    method: 'get'
  })
}

// @Tags User
// @Summary 更新用户信息
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {string} json "{"success":true,"data":{},"msg":"ok"}"
// @Router /updateUserInfo [post]
export const postUpdateUserProfile = (data) => {
  return service({
    url: groupPrefix + '/updateUserProfile',
    method: 'post',
    data: data
  })
}